package packet

import (
	"encoding/hex"
	"hy_808/protocol/hygprs"
	"strings"
)

/*
设备响应

+0  80 00 22 02 05 52 92
+7  01 00 00 00 08
+12 02 00 00 00 EA
+17 04 00 01 86 A1
+22 06 61 77 BA F0
+27 1A 01
+29 00 00 06 51 81
+34
*/

type DeviceAnswer struct {
	hygprs.Fields
}

func GenDeviceAnswer() DeviceAnswer {
	data, _ := hex.DecodeString(strings.ReplaceAll("80 00 24 02 15 2F 92 01 00 00 00 34 02 00 01 86 B1 03 01 04 00 01 86 A1 06 62 21 A8 09 1A 01 00 00 05 70 81", " ", ""))
	return DeviceAnswer{hygprs.MakeFields(hygprs.MakePacket(data))}
}

//func (p DeviceAnswer) SetLineID(v uint32) {
//	copy(p.Data[8:], hygprs.FromUint32(v))
//}
//
//func (p DeviceAnswer) SetBusID(v uint32) {
//	copy(p.Data[13:], hygprs.FromUint32(v))
//}
//
//func (p DeviceAnswer) SetDriverKH(v uint32) {
//	copy(p.Data[18:], hygprs.FromUint32(v))
//}
//
//func (p DeviceAnswer) SetUnix(v uint32) {
//	copy(p.Data[23:], hygprs.FromUint32(v))
//}

func (p DeviceAnswer) SetAnswer(v byte) {
	p.Data[28] = v
}
